#include "core/reactor/Acceptor.h"
#include "core/reactor/Dispatcher.h"
#include "core/log.h"
#include <unistd.h>
#include <iostream>
using namespace std;

int main()
{
    /*
    epollEngine epoll_instance;
    doubleBufferedQueue<epoll_event> queue_instance;
    connectionPool connections;
    MyLogger logger;*/
    int serverSocket = Socket::initListenSocket(1234, 1000, 1);
    if(serverSocket < 0){
        perror("socket init error");
        return 0;
    }
    //cycle_t data(queue_instance, epoll_instance, connections, serverSocket, logger);
    cycle_t data(serverSocket);
    cout << "The socket is " << serverSocket <<endl;
    Acceptor acceptor_instance(data);
    acceptor_instance.run(); // off you go
    Dispatcher dispatcher_instance(data);
    dispatcher_instance.run();
    while(true);
    return 0;
}
